/*
 * Copyright (C) 2007-2013 Geometer Plus <contact@geometerplus.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 */

package org.geometerplus.fbreader.bookmodel;

import org.geometerplus.fbreader.Paths;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.zlibrary.text.model.ZLTextModel;
import org.geometerplus.zlibrary.text.model.ZLTextWritablePlainModel;

import java.util.HashMap;
import java.util.Map;

/**
 * ceb 电子书的java book model
 * @author zouqp
 *   2014-09-29
 */

public class CebJavaBookModel extends JavaBookModel {
	private Map<String,ZLTextModel> BookTextModels = new HashMap<String,ZLTextModel>();
    private String currentChapterId;

	CebJavaBookModel(Book book) {
		super(book);
	}

	@Override
	public ZLTextModel getTextModel() {
		ZLTextModel model = BookTextModels.get(currentChapterId);
		return model;
	}
	
	@Override
	public ZLTextModel createTextModel( ){
		ZLTextModel	model = new ZLTextWritablePlainModel(currentChapterId, Book.getLanguage(), 1024, 65536, Paths.cacheDirectory() + "/" + currentChapterId, "cache", myImageMap);
		BookTextModels.put(currentChapterId, model); 
		return model;
	}
	
	@Override 
	public void setCurrentChapterid(String chapterId ){
		currentChapterId = chapterId;
	}
	
	public String getCurrentChapterid() {
		return currentChapterId;
	}
	
	
}
